package org.gruposp2p.proyectokarma.controller

import grails.converters.JSON
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.Authentication;

class LoginErrorController {

    def index = {
		SecurityContext securityContext = session.getAttribute("SPRING_SECURITY_CONTEXT");
		if (securityContext)  {
			Authentication authentication = securityContext.getAuthentication()
			log.debug " authentication.getPrincipal() : " + authentication.getPrincipal() 
		}
		log.debug " SPRING_SECURITY_LAST_USERNAME : " + session.getAttribute("SPRING_SECURITY_LAST_USERNAME");
		log.debug " SPRING_SECURITY_LAST_EXCEPTION : " + session.getAttribute("SPRING_SECURITY_LAST_EXCEPTION");
		response.status = 401;
        render "HTTP Status 401 - Full authentication is required to access this resource"
    }
    

}
